package org.vm.cmbcdirect.manager.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.vm.cmbcdirect.manager.model.User;
import org.vm.cmbcdirect.manager.service.UserService;

import java.util.List;

/**
 * Created by mv on 2016/3/22.
 */
@Controller
public class TestController {

    @Autowired
    protected UserService userService;

    @RequestMapping(value="test",method= RequestMethod.GET)
    public String testIndex(Model model){

        List<User> users = userService.selectAllUsers();
//        User user = new User("maplearch","1234");
//        userService.saveUser(user);
        model.addAttribute("param1", "参数1");
        model.addAttribute("param2", "参数2");
        model.addAttribute("users", users);
        return "test/index";
    }

    @RequestMapping(value="test2",method=RequestMethod.GET)
    public String testIndex2(Model model){
        model.addAttribute("param1", "参数1");
        model.addAttribute("param2", "参数2");
        return "test/cmbcdirect";
    }
}
